"""
设置一个抽奖程序，能够按照座位号抽奖
"""
import random
# 获得用户输入座位号
seat_num = int(input("请输入您的座位号(101~500)"))

# 随机生成两个101~500的随机数（中奖号码）
prize_num = [random.randint(101,500)for _ in range(2)]
print(f"中奖号码是",prize_num)
# 反转中奖号码为2等奖的中奖号码
reverse_prize_num = [str(prize_num[0]),str(prize_num[1])]
reverse_prize_num_list = []
reverse_prize_num_list.append(int(reverse_prize_num[0][::-1]))
reverse_prize_num_list.append(int(reverse_prize_num[1][::-1]))
second_prize_num = reverse_prize_num_list[:]

# 取出座位号的尾数与中奖号码的尾数
last_prize_num_list = [] # 初始化三等奖中奖号码列表
last_seat_num = int(str(seat_num)[-1]) # 座位号尾数
last_prize_num_list.append(int(str(prize_num[0])[-1]))
last_prize_num_list.append(int(str(prize_num[1])[-1]))
third_prize_num = last_prize_num_list[:]
# 定义函数判断是否中奖
def draw_prize(seat_num):
    """
    功能：根据座位号进行判断是否中奖
    :param seat_num: 座位号
    :return: None
    """
    if seat_num in prize_num:
        print("恭喜你获得一等奖")
    elif seat_num in second_prize_num:
        print("恭喜你获得二等奖")
    elif last_seat_num in third_prize_num:
        print("恭喜获得三等奖")
    else:
        print("很抱歉，你没有获奖")

# 调用函数
draw_prize(seat_num)
